import { defineComponent } from 'vue'
import { NLayoutContent } from 'naive-ui'
import { RouterView } from 'vue-router'
import { storeToRefs } from 'pinia'

import { useAppStore } from '@/store/app'

export default defineComponent({
  name: 'AppMain',
  setup() {
    const appStore = useAppStore()

    const { refreshKey } = storeToRefs(appStore)

    return {
      refreshKey
    }
  },
  render() {
    return (
      <NLayoutContent
        contentStyle={{ padding: '24px' }}
        builtinThemeOverrides={{
          color: 'transparent'
        }}>
        <RouterView key={this.refreshKey} />
      </NLayoutContent>
    )
  }
})
